﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using PostSharp.Aspects;

namespace EasyDLL.AOP.Attributes
{
    /// <summary>
    /// 将标记了该属性的方法加入线程池中异步执行
    /// </summary>
    [Serializable]
    public class WorkerThreadAttribute: MethodInterceptionAspect
    {
        public override void OnInvoke(MethodInterceptionArgs args)
        {
            ThreadPool.QueueUserWorkItem(delegate
                                             {
                                                 args.Proceed();
                                             });
        }
    }
}
